package com.fiberhome.ztelauncher.core;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.widget.MediaController;
import android.widget.VideoView;

import com.fiberhome.zte_launcher.R;


public class VideoActivity extends Activity {

    private VideoView vv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);

        vv = (VideoView) findViewById(R.id.videoview);

        String url = getIntent().getStringExtra("jumpURL");
        if (!TextUtils.isEmpty(url)) {
        	/* RTSP：Real Time Streaming Protocal，实时流媒体传输控制协议。 
        	 * 使用RTSP时，流媒体的格式需要是RTP。 rtsp://
        	 * RTSP和RTP是结合使用的，RTP单独在Android中式无法使用的。*/
            Uri uri = Uri.parse("http://flashmedia.eastday.com/newdate/news/2016-11/shznews1125-19.mp4");  
            vv.setMediaController(new MediaController(this));
            vv.setVideoURI(uri);
            vv.start();
//            vv.requestFocus();
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
